import React,{useState} from 'react'
import { Sticky } from 'react-vant';
//navbarInsert 传入的数据

export const NavBarModule = props =>{
    // console.log(props,'--------------------');
    const {changeBefore, changeAfter,height} = props.navBarObj
    const [bgColor,setBgColor] =useState(changeBefore)
    function changeBgColor(e){
        if (e===true) {
            setBgColor(changeAfter)
        }else{
            setBgColor(changeBefore)
        }
    }
  return (
    <Sticky onChange={changeBgColor}>
        <div style={{width:'100%',height:height,position:'fixed',zIndex:'999',background:bgColor}}>
            {props.navbarInsert}
        </div>
    </Sticky>
  )
}
